package com.way;

import java.nio.*;

/**
 * @PROJECT_NAME: ${PROJECT_NAME}
 * @DESCRIPTION:
 * @USER: 魏彪
 * @DATE: ${DATE} ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        byte[] byteArray = new byte[]{1, 2, 3};
        short[] shortArray = new short[]{1, 2, 3, 4};
        int[] intArray = new int[]{1, 2, 3, 4};
        float[] floatArray = new float[]{1, 2, 3, 4, 5, 6, 7};
        double[] doubleArray = new double[]{1, 2, 3, 4, 5, 6, 7, 8};
        char[] charArray = new char[]{'a', 'b', 'c', 'd'};

        ByteBuffer byteBuffer = ByteBuffer.wrap(byteArray);
        ShortBuffer shortBuffer = ShortBuffer.wrap(shortArray);
        IntBuffer intBuffer = IntBuffer.wrap(intArray);
        FloatBuffer floatBuffer = FloatBuffer.wrap(floatArray);
        DoubleBuffer doubleBuffer = DoubleBuffer.wrap(doubleArray);
        CharBuffer charBuffer = CharBuffer.wrap(charArray);

        System.out.println("byteBuffer.getClass().getName() = " + byteBuffer.getClass().getName());
        System.out.println("shortBuffer.getClass().getName() = " + shortBuffer.getClass().getName());
        System.out.println("intBuffer.getClass().getName() = " + intBuffer.getClass().getName());
        System.out.println("floatBuffer.getClass().getName() = " + floatBuffer.getClass().getName());
        System.out.println("doubleBuffer.getClass().getName() = " + doubleBuffer.getClass().getName());
        System.out.println("charBuffer.getClass().getName() = " + charBuffer.getClass().getName());

        System.out.println();

        System.out.println("byteBuffer.capacity() = " + byteBuffer.capacity());
        System.out.println("shortBuffer.capacity() = " + shortBuffer.capacity());
        System.out.println("intBuffer.capacity() = " + intBuffer.capacity());
        System.out.println("floatBuffer.capacity() = " + floatBuffer.capacity());
        System.out.println("doubleBuffer.capacity() = " + doubleBuffer.capacity());
        System.out.println("charBuffer.capacity() = " + charBuffer.capacity());
    }
}